package GUI;
use JSON;

sub new {
        my $class   = shift;

        my $self = {};
        bless $self, 'GUI';
        return $self;
}

sub drawLine {
        my ($self, $line_length, $line_char)    = @_;
        my $output;

        for (my $i; $i < $line_length; $i++) {
                $output .=      "$line_char";
        }

        $output .= "\n";
        return $output;
}

sub convert_hash_to_json {
    my ($self, $hash_ref)   = @_;
#     print "hash = " . %$hash_ref . "<br>";
    my $json    = new JSON();
#     my $js      = $json->to_json($hash_ref);      # pass in the pointer to our hash
    my $js      = $json->objToJson(%$hash_ref);      # pass in the pointer to our hash
    print "js = " . $js . "<br>";
    return $js;
}

#   -- Dummy function to sanitize form input so malicious characters aren't being passed
sub sanitize_form_input {
    my ($self, $cgi_vars)    = @_;
    #   -- parse through all the params and clean each.  Return the cleaned up $cgi_vars
    return $cgi_vars;
}
1;